<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="https://unpkg.com/vue@next">
    
    </script>
    
    <div id="app">
        <todo-item></todo-item>
    </div>

    <script>
        const vueOpt = {}

        const app = Vue.createApp(vueOpt);

        app.component('todo-item', {
            template:`<input ref="input">
                <div ref="container">111</div>    
            `,
            data(){
                return {
                }
            },

            methods: {
                focusInput(){
                    // input属性时dom元素,可绑定多个dom元素
                    console.log(this.$refs, this.$refs.input);
                    console.log(this.$refs.container);
                    this.$refs.input.focus();
                }
            },

            mounted(){
                this.focusInput();
            }
        });

        app.mount('#app');

    </script>
</body>
</html>